package com.itheima03.day15;

import java.io.IOException;
import java.net.DatagramPacket;
import java.net.DatagramSocket;

/**
 * @author 刘全
 * @date 2021/8/9
 */
public class Service {
    public static void main(String[] args) throws IOException {
        DatagramSocket ds = new DatagramSocket(10000);

        while (true) {
            byte[] bytes = new byte[1024];
            DatagramPacket dp = new DatagramPacket(bytes,bytes.length);

            ds.receive(dp);
            System.out.println(new String(bytes,0,bytes.length));
        }
        //ds.close();
    }
}
